package Apps;

import Dao.UntilHive;

import java.sql.*;

public class ShowDataBaseList {
    private void ShowDBList(){
        Connection con = UntilHive.getCon();
        Statement stmt = null;
        ResultSet rs = null;
        try {
            stmt = con.createStatement();
            String sql = "SHOW DATABASES ";
            System.out.println("Running: " + sql);
            stmt.execute(sql);
            rs = stmt.getResultSet();
            while (rs.next()){
                System.out.println(rs.getString(1));

            }

        } catch (SQLException e) {
            e.printStackTrace();
            System.out.println("error");
        } finally {
            UntilHive.closeAll(con, stmt, rs);
        }

    }

    public static void main( String[] args )  {
        new ShowDataBaseList().ShowDBList();

    }
}
